<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>安卓设备投屏控制工具</title>
    <link rel="stylesheet" href="style.css">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
</head>
<body>
    <div class="container">
        <!-- 头部 -->
        <header class="header">
            <h1><i class="fas fa-mobile-alt"></i> 安卓设备投屏控制工具</h1>
            <div class="header-controls">
                <button id="refreshDevices" class="btn btn-primary">
                    <i class="fas fa-sync-alt"></i> 刷新设备
                </button>
                <button id="checkStatus" class="btn btn-info">
                    <i class="fas fa-info-circle"></i> 检查状态
                </button>
            </div>
        </header>

        <!-- 状态栏 -->
        <div class="status-bar" id="statusBar">
            <div class="status-item">
                <i class="fas fa-server"></i>
                <span id="serverStatus">服务器状态: 检查中...</span>
            </div>
            <div class="status-item">
                <i class="fas fa-tools"></i>
                <span id="scrcpyStatus">scrcpy: 检查中...</span>
            </div>
            <div class="status-item">
                <i class="fas fa-android"></i>
                <span id="adbStatus">ADB: 检查中...</span>
            </div>
        </div>

        <!-- 主要内容区域 -->
        <main class="main-content">
            <!-- 设备列表页面 -->
            <div id="deviceListPage" class="page active">
                <div class="page-header">
                    <h2><i class="fas fa-list"></i> 已连接设备</h2>
                    <p>检测到以下通过USB连接的安卓设备</p>
                </div>
                
                <div id="deviceList" class="device-list">
                    <div class="loading">
                        <i class="fas fa-spinner fa-spin"></i>
                        <span>正在扫描设备...</span>
                    </div>
                </div>
                
                <div id="noDevices" class="no-devices" style="display: none;">
                    <i class="fas fa-exclamation-triangle"></i>
                    <h3>未检测到设备</h3>
                    <p>请确保：</p>
                    <ul>
                        <li>安卓设备已通过USB连接到电脑</li>
                        <li>设备已开启USB调试模式</li>
                        <li>设备已授权调试连接</li>
                    </ul>
                    <button id="retryScan" class="btn btn-primary">
                        <i class="fas fa-redo"></i> 重新扫描
                    </button>
                </div>
            </div>

            <!-- 投屏控制页面 -->
            <div id="streamingPage" class="page">
                <div class="page-header">
                    <button id="backToDevices" class="btn btn-secondary">
                        <i class="fas fa-arrow-left"></i> 返回设备列表
                    </button>
                    <h2 id="streamingDeviceName">设备投屏</h2>
                    <div class="streaming-controls">
                        <button id="takeScreenshot" class="btn btn-success">
                            <i class="fas fa-camera"></i> 截图
                        </button>
                        <button id="stopStream" class="btn btn-danger">
                            <i class="fas fa-stop"></i> 停止投屏
                        </button>
                    </div>
                </div>

                <!-- 设备信息卡片 -->
                <div class="device-info-card" id="deviceInfoCard">
                    <div class="info-header">
                        <i class="fas fa-info-circle"></i>
                        <span>设备信息</span>
                        <button id="toggleDeviceInfo" class="btn-toggle">
                            <i class="fas fa-chevron-down"></i>
                        </button>
                    </div>
                    <div class="info-content" id="deviceInfoContent">
                        <div class="loading">
                            <i class="fas fa-spinner fa-spin"></i>
                            <span>加载设备信息...</span>
                        </div>
                    </div>
                </div>

                <!-- 视频显示区域 -->
                <div class="video-container">
                    <video id="videoPlayer" autoplay muted>
                        您的浏览器不支持视频播放
                    </video>
                    
                    <!-- 视频控制覆盖层 -->
                    <div class="video-overlay" id="videoOverlay">
                        <div class="overlay-content">
                            <i class="fas fa-play"></i>
                            <p>点击开始投屏</p>
                        </div>
                    </div>
                    
                    <!-- 触摸提示 -->
                    <div class="touch-hint" id="touchHint">
                        <i class="fas fa-hand-pointer"></i>
                        <span>触摸屏幕进行控制</span>
                    </div>
                </div>

                <!-- 控制按钮区域 -->
                <div class="control-panel">
                    <div class="control-section">
                        <h3><i class="fas fa-home"></i> 系统控制</h3>
                        <div class="control-buttons">
                            <button class="control-btn" data-action="home">
                                <i class="fas fa-home"></i>
                                <span>Home</span>
                            </button>
                            <button class="control-btn" data-action="back">
                                <i class="fas fa-arrow-left"></i>
                                <span>Back</span>
                            </button>
                            <button class="control-btn" data-action="app_switch">
                                <i class="fas fa-window-restore"></i>
                                <span>App Switch</span>
                            </button>
                            <button class="control-btn" data-action="power">
                                <i class="fas fa-power-off"></i>
                                <span>Power</span>
                            </button>
                        </div>
                    </div>

                    <div class="control-section">
                        <h3><i class="fas fa-volume-up"></i> 音量控制</h3>
                        <div class="control-buttons">
                            <button class="control-btn" data-action="volume_up">
                                <i class="fas fa-volume-up"></i>
                                <span>音量+</span>
                            </button>
                            <button class="control-btn" data-action="volume_down">
                                <i class="fas fa-volume-down"></i>
                                <span>音量-</span>
                            </button>
                            <button class="control-btn" data-action="volume_mute">
                                <i class="fas fa-volume-mute"></i>
                                <span>静音</span>
                            </button>
                        </div>
                    </div>

                    <div class="control-section">
                        <h3><i class="fas fa-keyboard"></i> 文本输入</h3>
                        <div class="text-input-control">
                            <input type="text" id="textInput" placeholder="输入要发送的文本...">
                            <button id="sendText" class="btn btn-primary">
                                <i class="fas fa-paper-plane"></i> 发送
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </main>

        <!-- 通知区域 -->
        <div id="notifications" class="notifications"></div>
    </div>

    <!-- 加载脚本 -->
    <script src="/socket.io/socket.io.js"></script>
    <script src="app.js"></script>
</body>
</html>